<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8" >
	<meta http-equiv="Access-Control-Allow-Origin" content="bsphp.dqwlyz.cn">
	<title>上传并请求接口</title>
	<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
	<h1>批量解绑：</h1>
	<input type="file" id="fileInput">
	<button onclick="uploadFile()">开始解绑</button>

	<script>
		function uploadFile() {
			const fileInput = document.getElementById('fileInput');

			if (fileInput.files.length === 0) {
				console.log('请选择一个文件');
				return;
			}

			const file = fileInput.files[0];
			const reader = new FileReader();

			reader.onload = function (event) {
				const contents = event.target.result;
				console.log(contents)
				const params = contents.split(",");

				for (let i = 0; i < params.length; i++) {
					const param = params[i].trim();
					sendRequest(param);
				}
			};

			reader.readAsText(file);
		}


		function sendRequest(param) {
			$.ajax({
				url: 'http://bsphp.dqwlyz.cn/jb/?btwaf=80264906',
				type: 'POST',
				dataType: 'form-data',
				data: {
					code: param
				},
				success: function(response) {
					console.log(response);
				},
				error: function(jqXHR, textStatus, errorThrown) {
					console.log('错误：' + errorThrown);
				}
			});
		}

		function displayResult(result) {
			const resultContainer = document.getElementById('resultContainer');
			resultContainer.innerHTML += result + "<br>";
		}
	</script>
</body>
</html>